import React, { PureComponent } from 'react'

// 定义一个高阶组件
function hoc(Cpn) {
  class NewCpn extends PureComponent {
    render() {
      return <Cpn name="why" />
    }
  }

  return NewCpn
}

class HelloWorld extends PureComponent {
  render() {
    return <h1>Hello World</h1>
  }
}

const HelloWorldHoc = hoc(HelloWorld)

export class App extends PureComponent {
  render() {
    return (
      <div>
        <h2>App page</h2>
        <HelloWorldHoc />
      </div>
    )
  }
}

export default App
